package com.ricky.base.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
import org.springframework.security.concurrent.DelegatingSecurityContextExecutor;

import java.util.concurrent.Executor;

/**
 * @Author Ricky
 * @Date 2024/6/20 14:08
 **/
@Configuration
public class SecurityAsyncConfig extends AsyncConfigurerSupport {

    @Autowired
    private Executor asyncExecutor;

    @Override
    public Executor getAsyncExecutor() {
        return new DelegatingSecurityContextExecutor(asyncExecutor);
    }
}
